From cd7878eaad86a06774bd776a54a4eee5000efd69 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 10 Aug 2014 22:04:15 -0700 Subject: [PATCH] Add a configure option to disable cross-tests The tests are enabled by default and must be opted out of. Closes #346 --- Makefile.in | 1 + configure | 1 + tests/test_cargo_cross_compile.rs | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/Makefile.in b/Makefile.in index 277c4b220..b88e3f477 100644 --- a/Makefile.in +++ b/Makefile.in @@ -35,6 +35,7 @@ OPT_FLAG= endif export CFG_VERSION +export CFG_DISABLE_CROSS_TESTS ifeq ($(OS),Windows_NT) X = .exe diff --git a/configure b/configure index 091c04000..f9a34c04e 100755 --- a/configure +++ b/configure @@ -293,6 +293,7 @@ opt debug 1 "build with extra debug fun" opt optimize 0 "build with optimizations" opt nightly 0 "build nightly packages" opt verify-install 1 "verify installed binaries work" +opt cross-tests 1 "run cross-compilation tests" valopt prefix "/usr/local" "set installation prefix" valopt local-rust-root "" "set prefix for local rust binary" diff --git a/tests/test_cargo_cross_compile.rs b/tests/test_cargo_cross_compile.rs index 6a3bcc49f..035bc45e6 100644 --- a/tests/test_cargo_cross_compile.rs +++ b/tests/test_cargo_cross_compile.rs @@ -14,6 +14,13 @@ use cargo::util::process; fn setup() { } +fn disabled() -> bool { + match os::getenv("CFG_DISABLE_CROSS_TESTS") { + Some(ref s) if s.as_slice() == "1" => true, + _ => false, + } +} + fn alternate() -> &'static str { match os::consts::SYSNAME { "linux" => "i686-unknown-linux-gnu", @@ -23,6 +30,8 @@ fn alternate() -> &'static str { } test!(simple_cross { + if disabled() { return } + let p = project("foo") .file("Cargo.toml", basic_bin_manifest("foo").as_slice()) .file("src/foo.rs", r#" @@ -43,6 +52,8 @@ test!(simple_cross { }) test!(simple_deps { + if disabled() { return } + let p = project("foo") .file("Cargo.toml", r#" [package] @@ -78,6 +89,8 @@ test!(simple_deps { }) test!(plugin_deps { + if disabled() { return } + let foo = project("foo") .file("Cargo.toml", r#" [package] @@ -154,6 +167,8 @@ test!(plugin_deps { }) test!(plugin_to_the_max { + if disabled() { return } + let foo = project("foo") .file("Cargo.toml", r#" [package] @@ -237,6 +252,8 @@ test!(plugin_to_the_max { }) test!(linker_and_ar { + if disabled() { return } + let target = alternate(); let p = project("foo") .file(".cargo/config", format!(r#" @@ -275,6 +292,8 @@ test!(linker_and_ar { }) test!(plugin_with_extra_dylib_dep { + if disabled() { return } + let foo = project("foo") .file("Cargo.toml", r#" [package] @@ -339,6 +358,8 @@ test!(plugin_with_extra_dylib_dep { }) test!(cross_tests { + if disabled() { return } + let p = project("foo") .file("Cargo.toml", r#" [project] -- 2.30.2